package com.ztom.test.bean

import com.ztom.beans.factory.support.lifecycle.DisposableBean
import com.ztom.beans.factory.support.lifecycle.InitializingBean

/**
 * 使用数据类, 主构造必须指定至少一个字段,
 * 也就是无法有无参构造, 只能使用默认值了
 *
 * @author ZhangTao
 */
data class Person(
    var name: String? = null,
    var age: Int? = null,
    var car: Car? = null
) : InitializingBean, DisposableBean {

    fun init() {
        println("Person init method invoke...")
    }

    fun destroyMethod() {
        println("Person destroyMethod invoke...")
    }

    override fun destroy() {
        println("Person DisposableBean destroy invoke...")
    }

    override fun afterPropertiesSet() {
        println("Person InitializingBean afterPropertiesSet invoke...")
    }
}